import http from '@/utils/http'

/**
 * 添加购物车
 * @param {*} data
 * @returns
 */
export const addMemberCartAPI = data => {
  return http({
    url: '/member/cart',
    method: 'POST',
    data
  })
}

/**
 * 获取购物车列表
 * @returns
 */
export const getMemberCartAPI = () => {
  return http({
    url: '/member/cart'
  })
}

/**
 * 修改 购物车单品
 * @param {*} skuId
 * @param {*} data
 * @returns
 */
export const editMemberCartAPI = (skuId, data) => {
  return http({
    url: `/member/cart/${skuId}`,
    method: 'PUT',
    data
  })
}

/**
 * 全选/反选商品
 * @returns
 */
export const selectAllMemberCartAPI = data => {
  return http({
    url: '/member/cart/selected',
    method: 'PUT',
    data
  })
}

/**
 * 删除/清空用户购物车信息
 * @param {*} data
 * @returns
 */
export const delMemberCartAPI = data => {
  return http({
    url: '/member/cart',
    method: 'DELETE',
    data
  })
}
